import QtQuick
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Tumbler样式2")

    Tumbler {
        id: tumbler
        anchors.centerIn: parent
        model: ["S", "M", "L", "XL", "XXL"]

        // 手动添加高亮矩形
        Rectangle {
            parent: tumbler.contentItem
            width: tumbler.width
            height: tumbler.height / tumbler.visibleItemCount
            color: "#21be2b"
            opacity: 0.3
            radius: 5
            y: Math.floor(tumbler.height / 2 - height / 2)  // 固定在中间
        }
    }
}
